﻿<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Functions_model extends CI_Model {

    var $fname   = '';
    var $flink = '';
    var $ffile    = '';
    var $fdate    = '';
    var $factive    = '';

    function __construct()
    {
        // Call the Model constructor
        parent::__construct();
    }
    
    function getlistfunctions()
    {
    	$this->load->database('default'); 
		$query = $this->db->get('tblfunction');
		if ($query->num_rows() > 0)
        {
          return $query->result();
        } else {
          return array();
        } 
    }

    function insert_functions()
    {
        $this->fname   = $_POST['fname'];  
        $this->flink = $_POST['flink'];
        $this->ffile   = $_POST['ffile'];  
        $this->fdate = $_POST['fdate'];
        $this->factive   = $_POST['factive'];
        $this->db->insert('tblfunction', $this);
    }

    function update_entry()
    {
        $this->title   = $_POST['title'];
        $this->content = $_POST['content'];
        $this->date    = time(); 
        $this->db->update('entries', $this, array('id' => $_POST['id']));
    }

}